//
//  EventsPullRefreshStatusView.swift
//  ChildStory
//
//  Created by linhan on 2016/12/17.
//  Copyright © 2016年 Aiya. All rights reserved.
//

import Foundation
import UIKit

class EventsPullRefreshStatusView: UIView,PullToRefreshViewDelegate
{
    func pullToRefreshAnimationDidStart(_ view: PullToRefreshView){}
    func pullToRefreshAnimationDidEnd(_ view: PullToRefreshView){}
    func pullToRefresh(_ view: PullToRefreshView, progressDidChange progress: CGFloat){}
    func pullToRefresh(_ view: PullToRefreshView, stateDidChange state: PullToRefreshViewState){}
    
    var events:String = ""{
        didSet{
            _label1.text = "新事件\(events)"
        }
    }
    
    var days:Int = 0{
        didSet{
            _label2.text = "\(days)天后开启"
        }
    }
    
    private var _label1:UILabel = UILabel()
    private var _label2:UILabel = UILabel()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setup()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setup()
    {
        let arrow:UIImageView = UIImageView(image: UIImage(named:"global_img_fresh_1"))
        arrow.center = CGPointMake(width * 0.5, arrow.height * 0.5)
        arrow.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin]
        addSubview(arrow)
        
        _label1.textColor = UIColor(hex: 0x595757)
        _label1.font = UIFont.systemFont(ofSize: 12)
        _label1.textAlignment = .center
        _label1.frame = CGRectMake(0, arrow.bottom + 8, width, 16)
        _label1.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin, .flexibleWidth]
        addSubview(_label1)
        
        _label2.textColor = UIColor(hex: 0x595757)
        _label2.font = UIFont.systemFont(ofSize: 12)
        _label2.textAlignment = .center
        _label2.frame = CGRectMake(0, _label1.bottom + 4, width, 16)
        _label2.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin, .flexibleWidth]
        addSubview(_label2)
        
    }
}
